package com.tanhua.server.service;

import com.tanhua.dubbo.api.UserLocationApi;
import com.tanhua.server.interceptor.UserHolder;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

/**
 * @program: tanhua
 * @description:
 * @author: MR.peng
 * @create: 2022-03-27 22:01
 **/
@Service
public class BaiduService {

    @DubboReference
    private UserLocationApi userLocationApi;

    //上报地理位置
    public void location(Double latitude, Double longitude, String addrStr) {
        //1.获取用户id
        Long userId = UserHolder.getUserId();
        //2.调用API进行保存数据（不能传输UserLocation对象）
        userLocationApi.save(userId,latitude,longitude,addrStr);
    }
}
